// Copyright (c) 2007-2008, 
// Marc Speck, http://www.faindu.com
// All Rights Reserved. The following is Source Code and is subject to all restrictions 
// on such code as contained in the license accompanying this product.
package com.faindu.editImage.scale
{
import com.faindu.editImage.base.BaseCursor;
import com.faindu.editImage.base.BaseTool;

import flash.display.BitmapData;

import mx.core.BitmapAsset;

/**
 * The cursor shown when the user hovers over the control.
*/
public class ScaleCursor extends BaseCursor
{
	/**
	 * Constructor
	 */
	public function ScaleCursor( referenceName:String ) 
	{
		var angleInDegrees:Number = 0

		switch ( referenceName )
		{
			case BaseTool.TOP_LEFT:
				angleInDegrees = 45
				offset_x = 25
				offset_y = 10					
				break;

			case BaseTool.TOP:
				angleInDegrees = 90
				offset_x = 12
				offset_y = 20					
				break;

			case BaseTool.TOP_RIGHT:
				angleInDegrees = +135
				offset_x = 0
				offset_y = 20				
				break;

 			case BaseTool.RIGHT:
				angleInDegrees = 180
				offset_x = -10
				offset_y = 14				
				break;

			case BaseTool.BOTTOM_RIGHT:
				angleInDegrees = -135
				offset_x = -18
				offset_y = 0					
				break;

			case BaseTool.BOTTOM:
				angleInDegrees = -90
				offset_x = -10
				offset_y = -5					
				break;

			case BaseTool.BOTTOM_LEFT:
				angleInDegrees = -45
				offset_x = 5
				offset_y = -15					
				break;

			case BaseTool.LEFT:
				angleInDegrees = 0
				offset_x = 20
				offset_y = -10			
				break; 
		}
		
		var cursorBitmapAsset: BitmapAsset = BitmapAsset( new cursorHorizontalClass() )
		cursorBitmapAsset.smoothing = true
		cursorBitmapAsset.rotation =  angleInDegrees
		addChild( cursorBitmapAsset )
	}

	[Bindable]
	[Embed(source='/com/faindu/editImage/assets/lc_arrowshapes.left-right-arrow.png')]
	private var cursorHorizontalClass:Class;	
	
}
}